package homework;

import Be.cn.event.one;
import Be.cn.event.two;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.support.AnnotationConfigContextLoader;

;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(loader = AnnotationConfigContextLoader.class, classes = {two.class})
public class three {
    @Autowired
    private ApplicationEventPublisher applicationEventPublisher;
    @Test
    public void method1(){
        System.out.println("发布事件:");
        applicationEventPublisher.publishEvent(new one("dgut"));
        System.out.println("结束发布事件!");
    }

}
